export const setStorage = (itemName, data) => {
  if (typeof data === 'object') {
    window.localStorage.setItem(itemName, JSON.stringify(data))
  } else {
    window.localStorage.setItem(itemName, data)
  }
}

export const getStorage = (itemName) => {
  const data = window.localStorage.getItem(itemName)
  try {
    return JSON.parse(data)
  } catch {
    return data
  }
}
